﻿namespace Web.Control.WWW.Session
{
    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using Model.WWW_User.Teach;
    using BLF.WWW_User.Teach;
    using Lx.Web.Common.ControlsUI;
    using System.Collections.Generic;
    using System.Collections;
    using Model.WWW_User.User;
    public class Admin : BaseControl
    {
        protected Repeater repsess;
        /// <summary>
        /// 页面
        /// </summary>
        protected int pageIndex = 1;
        protected Literal lLCount;
        private int l = 15;
        /// <summary>
        /// 数据数量
        /// </summary>
        protected int RecordCount = 0;
        protected string nickname = "";
        protected string s = "1";
        protected string Memberno;
        protected override void OnLoad(EventArgs e)
        {
            Memberno = HttpContext.Current.User.Identity.Name;
            ArrayList arrylist = new ArrayList();
            if (Memberno == "")
            {
                Page.Response.Redirect("/user/login.htm?ReturnUrl=" + Page.Request.Url.AbsoluteUri);
                return;
            }
            if (!string.IsNullOrEmpty(Request["p"]))
            {
                if (Request["p"] == "L")
                {
                    pageIndex = 9999;
                }
                else
                {
                    int.TryParse(Request["p"], out pageIndex);
                }
            }
            if (!string.IsNullOrEmpty(Request["s"]))
            {
                s = Request["s"].ToString().Trim();

            }
            if (lLCount != null) int.TryParse(lLCount.Text, out l);
            arrylist = Teach.GetAllSesStateC(Memberno, pageIndex, l, s);
                if (arrylist != null && arrylist.Count > 0)
                {
                    RecordCount = (int)arrylist[1];
                    int pCount = (int)Math.Ceiling(((decimal)RecordCount) / ((decimal)l));
                    if (pageIndex > pCount) pageIndex = pCount;
                    nickname = (string)arrylist[2];
                    if (repsess != null)
                    {
                        repsess.DataSource = arrylist[0];//list SessionsModel sm.TToSDesc=dr["TeachURL"] sm.SToTDesc=dr["Notion"]先用这2个代替；
                        repsess.DataBind();
                    }
                }
            base.OnLoad(e);
        }
    }
}